home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_100 / 111_01 / sqdebug.c < prev    next >
Text File  |  1985-08-19  |  1KB  |  51 lines

  1. /*
  2. HEADER:        ;
  3. TITLE:        Squeezer;
  4. DESCRIPTION:    "Auxiliary file for the SQ.C and USQ.C package.
  5.         See SQUEEZER.DOC.";
  6. SYSTEM:        CP/M-80;
  7. FILENAME:    SQDEBUG.C;
  8. SEE-ALSO:    SQUEEZER.DOC;
  9. AUTHORS:    Dick Greenlaw;
  10. COMPILERS:    BDS C;
  11. */
  12. /* Debugging aids for SQ and related modules */
  13.  
  14. #include <bdscio.h>
  15. #include <dio.h>
  16. #include "sqcom.h"
  17. #include "sq.h"
  18.  
  19. pcounts()
  20. {
  21.     int i;
  22.  
  23.     if(debug) {
  24.         puts("\nCounts after 1st algorithm and maybe scaling");
  25.         for(i = 0; i < NUMVALS; ++i) {
  26.             if(i%8 == 0)
  27.                 printf("\n%4X  ", i);
  28.             printf("%5u  ", node[i].weight);
  29.         }
  30.     puts("\n\n");
  31.     }
  32. }
  33.  
  34. phuff()
  35. {
  36.     int i;
  37.  
  38.     if(debug) {
  39.         printf("\nEncoding tree - root=%3d\n", dctreehd);
  40.         for(i = 0; i < NUMNODES; ++i)
  41.             if(node[i].weight != 0)
  42.                 printf("%3d  w=%5u d=%3d l=%3d r=%3d\n", i, node[i].weight, node[i].tdepth, node[i].lchild, node[i].rchild);
  43.  
  44.         printf("\nHuffman codes\n");
  45.         for(i = 0; i < NUMVALS; ++i) {
  46.             if(codelen[i] > 0)
  47.                 printf("%3d  %4X l=%2d c=%4x\n", i, i, codelen[i], code[i]);
  48.         }
  49.     }
  50. }
  51.